/* 代码块全局样式 */
pre {
  position: relative;
  margin: 1em 0;
  padding: 1.5em 1em 1em;
  background-color: #1e1e1e !important;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-height: 350px;
  transition: max-height 0.3s ease;
  /* 复制按钮样式 */
  /* 展开按钮样式 */
  /* 代码块本身的样式 */
  /* 语言标签 */
}
pre.expanded {
  max-height: none;
}
pre .code-copy-btn {
  position: absolute;
  top: 3px;
  left: 10px;
  padding: 4px 8px;
  font-size: 12px;
  color: #d4d4d4;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}
pre .code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}
pre .code-copy-btn.copied {
  background: #28a745;
  border-color: #28a745;
  color: white;
  opacity: 1;
}
pre .code-expand-btn {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, #1e1e1e 40%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
  opacity: 1;
  padding-bottom: 10px;
}
pre .code-expand-btn::after {
  content: '展开代码';
  color: #fff;
  font-size: 13px;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}
pre .code-expand-btn:hover::after {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}
pre .code-expand-btn.expanded::after {
  content: '收起代码';
}
pre:hover .code-copy-btn {
  opacity: 1;
}
pre code {
  display: block;
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  word-break: normal;
  word-wrap: normal;
  color: #d4d4d4;
}
pre code.hljs {
  padding: 0;
  background: transparent;
}
pre[class*="language-"]::before {
  content: attr(class);
  position: absolute;
  top: 0;
  left: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: #d4d4d4;
  background: #2d2d2d;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
  text-transform: uppercase;
  transform: lowercase;
  opacity: 0.7;
}
